<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        function clickAll() {
            var values = document.getElementsByTagName("input");
            for(var i = 0;i<values.length;i++){
                values[i].checked = true;
            }
        }
    </script>
</head>
<body>
    兴趣爱好:<input type="checkbox" value="java" checked="checked">Java
            <input type="checkbox" value="java" >C++
            <input type="checkbox" value="java" >PHP
            <br/>
    <button onclick="clickAll()">全选</button>
    <button>反选</button>
    <button>全不选</button>
</body>
</html>